package com.wzh.designmode.create.singleton;
/**
 * 双检锁/双重校验锁
 * @author wzh
 *
 */
public class DoubleLockSingle {
 private volatile static DoubleLockSingle single;
 private DoubleLockSingle (){}
 public static DoubleLockSingle getInit(){
	 if (single==null) {
		synchronized(DoubleLockSingle.class){ //锁住的是这个DoubleLockSingle 对象 等价于 static synchronized(){}
			if (single==null) {
				single=new DoubleLockSingle();
			}
		}
	}
	 return single;
 }
}
